<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>微信扫码登录</title>
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/admin/reg/font_24081_qs69ykjbea.css">
    <link rel="stylesheet" href="/admin/lib/layui-v2.4.5/layui/css/layui.css">
    <link rel="stylesheet" href="/admin/reg/global.css" charset="utf-8"> {{--
    <link id="layuicss-layer" rel="stylesheet" href="/admin/reg/layer.css" media="all"> --}}
    <style> 
        #qrcode {
            cursor: pointer;
        }
        .layui-icon {
            position: relative;
            top: 2px;
            font-size: 26px;
        }

        .layui-icon-login-wechat {
            color: #4DAF29;
        }
    </style>

</head>

<body>
    <div class="fly-header layui-bg-black">
        <div class="layui-container"> 
            {{-- <a class="fly-logo" href="#"> 
                <img src="/admin/reg/HB.ico" alt="layui">
            </a> --}}
            <span style="line-height: 61px;font-size:16px;/* margin-left: 55px; */">{{$name_rep}}</span>
            {{-- <ul class="layui-nav fly-nav-user">
                <li class="layui-nav-item"> <a class="iconfont icon-touxiang layui-hide-xs" href="/{{config('constant.name_admin')}}/public/reg"></a> </li>
                <li class="layui-nav-item"> <a href="/{{config('constant.name_admin')}}/public/reg">注册</a> </li>
            </ul> --}}
        </div>
    </div>
    <div class="layui-container fly-marginTop">
        <div class="fly-panel fly-panel-user" pad20="">
            <div class="layui-tab layui-tab-brief" lay-filter="user">
                <ul class="layui-tab-title">
                    <li><a href="{{ route('loginAdmin') }}">账号密码登录</a></li>
                    <li class="layui-this">微信扫码登录</li>
                </ul>
                <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
                    <div class="layui-tab-item layui-show">
                        <div class="layui-form layui-form-pane">
                            <center>
                                @if ($url === 'none')
                                <p style="font-size:22px">微信二维码获取失败，请刷新页面后重试</p>
                                @else
                                <img id="qrcode" title="刷新" src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(150)->margin(0)->generate($url)) !!} ">
                                @endif
                                <p style="margin-top:10px;font-size:17px"><i class="layui-icon layui-icon-login-wechat"></i> 微信扫码</p>
                            </center>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
   
    <div class="fly-footer">
        @if (config('constant.is_huibang'))
            <p>本系统由<a href="http://www.hbdq.net/" target="_blank">保定市汇邦电气有限公司</a>提供技术支持</p>
        @endif
        <p>备案号：<a href="http://www.beian.miit.gov.cn" target="_blank">冀ICP备05003073号</a></p>
    </div>
    <script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
    <script src="/admin/lib/layui-v2.4.5/layui/layui.js"></script>
    <script>
        $(function() {
            window.setInterval(function() {

                $.ajax({
                    type: 'post',
                    url: "/{{config('constant.name_admin')}}/public/checkWeChat",
                    // dataType: 'json',
                    data:{
                        ticket:"{{$ticket}}",
                        _token:'{{ csrf_token() }}',
                    },
                    success: function(data) {
                        // console.log(data);
                        if (data === 'true') {
                            layer.msg('登录成功!', {
                                icon: 1,
                                time: 2000
                            });
                            window.location.href = "/{{config('constant.name_admin')}}/index/index";
                        } 
                    },
                });
            }, 2000);

            layui.use(['layer', 'form'], function() {
                var layer = layui.layer,
                    form = layui.form;
              
                //点击刷新页面
                $('#qrcode').click(function() {
                    location.replace(location.href);
                });
            }); //layui.use---end
        }); //$(function()---end
    </script>
</body>

</html>